using Common.Commands;
using Common.Commands.ContactCommands;
using Core.Domain.Model;
using Sanelib.DataOperation;
using Sanelib.Dto;

namespace Core.Processors.AssignedContactProcessors
{
	public class DeleteAssignedContactProcessor : ICommandProcessor<DeleteAssignedContact>
	{
		private readonly IRepository<AssignedContact> _assignedcontactRepository;

		public DeleteAssignedContactProcessor(IRepository<AssignedContact> assignedcontactRepository)
		{
			_assignedcontactRepository = assignedcontactRepository;
		}

		public dynamic Process(DeleteAssignedContact command)
 		{
			var response = new WebApiResultResponse();

			var assignedcontact = _assignedcontactRepository.GetById(command.Id);

			_assignedcontactRepository.Delete(assignedcontact.Id);
			response.IsSuccess = true;

			return response;
		}
	}
}
